package com.chlitina.store.common.utils;

import java.text.DecimalFormat;

public class DataFormater {
	public static DecimalFormat format_1 = new DecimalFormat("0.##%");
	public static DecimalFormat format_money = new DecimalFormat("0.##");

	/**
	 * Format using Pattern "0.##%"
	 * @param value
	 * @return
	 */
	public static String format(double value) {
		return format_1.format(value);
	}
	/**
	 * Format using Pattern "0.##"
	 * @param value
	 * @return
	 */
	public static String formatMoneyString(double value) {
		return format_money.format(value);
	}
	/**
	 * Format using Pattern "0.##"
	 * @param value
	 * @return
	 */
	public static float formatMoneyFloat(double value) {
		return Float.valueOf(format_money.format(value));
	}
	
	public static void main(String[] args) {
		System.err.println(format(78.9912222));
		System.err.println(formatMoneyString(100));
		System.err.println(formatMoneyString(100.0));
		System.err.println(formatMoneyString(100.01111));
		System.err.println(formatMoneyString(100.01555));
	}
}
